<?php
/**
 * @since   2022-02-13
 * @author  zhaoxiang <zhaoxiang051405@gmail.com>
 */

namespace App\Controller;

use Hyperf\Contract\OnReceiveInterface;

class TcpServer implements OnReceiveInterface {

    public function onReceive($server, int $fd, int $reactorId, string $data): void {
//        $server->set(array(
//            'open_length_check' => true,
//            'package_max_length' => 256,
//            'package_length_type' => 'v', //see php pack()
//            'package_length_offset' => 3,
//            'package_body_offset' => 5,
//        ));
        $server->send($fd, $data);
    }
}
